<template>
  <router-view v-if="ready" />
</template>

<script>
import { autoLogin } from '@/api/user.js'
export default {
  data(){
    return{
      ready:false
    }
  },
  created() {
    autoLogin().then(res => {
      // console.log(res)
      this.ready=true
      if (res.code == 200) {
        this.$store.commit("user/setUser", res.data)
      }
    }).catch(()=>{
      this.ready=true
    })
  }
}
</script>

<style>
html,
body,
#app {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}
*{
  box-sizing: border-box;
}
</style>
